//
//  CYWebInfoFactory.swift
//  Exchange
//
//  Created by 孟祥群 on 2018/5/10.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit
enum exchangeStyle:String {
    case exchangeBase = "exchangeBase" //基础配置
    case exchangeTick = "exchange_tick" //汇率
    case exchangeDepth = "exchange_depth" //行情市场信息
    case exchangeChart = "exchange_chart" //聚合tick推送
    case exchangeMerge_depth_withlp = "exchangeMerge_depth_withlp" //聚合深度推送带交易所
    case exchangeSubscribe_merge_depth = "exchangeSubscribe_merge_depth" //聚合深度推送
    case exchangeSubscribeall = "exchangeSubscribeall" //subscribeall 兼容老接口
}
class ExchangeWebInfoFactory: NSObject {
    var webInfor:Dictionary = [String:ExchangeWebInfo]()
    class func sharedInstance() -> ExchangeWebInfoFactory
    {
        return manger
    }
    static let manger: ExchangeWebInfoFactory  = {
        return ExchangeWebInfoFactory()
    }()
    
    func archiveWebInfor(identifier:exchangeStyle) -> ExchangeWebInfo? {
        if (webInfor[identifier.rawValue] == nil) {
            webInfor[identifier.rawValue] = self.updateWebInfor(identifier:identifier)
        }
        return self.webInfor[identifier.rawValue]
    }
    
    
    func updateWebInfor(identifier:exchangeStyle) -> ExchangeWebInfo?{
        if identifier == .exchangeTick {
            let infor = ExchangeTick()
            return infor
        }else if identifier == .exchangeDepth {
            let infor = ExchangeDepth()
            return infor
        }else if identifier == .exchangeChart {
            let infor = ExchangeChart()
            return infor
        }else if identifier == .exchangeMerge_depth_withlp {
            let infor = ExchangeMergeWithlpInfo()
            return infor
        }else if identifier == .exchangeSubscribe_merge_depth {
            let infor = ExchangeSubscribeDepthInfo()
            return infor
        }else if identifier == .exchangeSubscribe_merge_depth {
            let infor = ExchangeSubscribeDepthInfo()
            return infor
        }else if identifier == .exchangeSubscribeall {
            let infor = ExchangeSubscriInfo()
            return infor
        }else {
            let infor = ExchangeBaseInfo()
            return infor
        }
    }
}
